This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com. Diverse cheatsheets can be found in https://www.rstudio.com/resources/cheatsheets/. This section gives quick instructions to display text, code, tables and figures.
Text in R markdown has several inline codes for costumization. The book in https://bookdown.org/yihui/rmarkdown/ offers a detailed guideline. Moreover, a cheatsheet can be downdloaded with the following link https://raw.githubusercontent.com/rstudio/cheatsheets/main/rmarkdown.pdf.
Code is automaticelly embedded unless echo chunk option is set to FALSE.
Evaluation of code in a given chunk can be skiped by setting eval to FALSE.
Code chunks should always be unically named.
#Example of code chunk
list(a = 1:6, b = 1:10)
$a [1] 1 2 3 4 5 6
$b [1] 1 2 3 4 5 6 7 8 9 10
The knitr::kable function can be used for displaying tables, see table 1.1. Consult https://haozhu233.github.io/kableExtra/awesome_table_in_html.html for other costumization options.
Table caption is added with the argument caption of the kable function.
df <- data.frame(name = c("a", "b", "c", "d", "e", "f"), col1 = 1:6, col2 = 1:6)
knitr::kable(df, caption = "Example of table caption.") %>%
kable_styling(
font_size = 12,
bootstrap_options = c("striped", "hover", "condensed", "responsive"),
fixed_thead = TRUE
)
| name | col1 | col2 |
|---|---|---|
| a | 1 | 1 |
| b | 2 | 2 |
| c | 3 | 3 |
| d | 4 | 4 |
| e | 5 | 5 |
| f | 6 | 6 |
Figures/plots can also by embedded using diverse packages.
The packages ggplot2 and plotly (interactive) are recommended as they are versatile and easy to use.
Cheatsheet for ggplot2 can be found in https://raw.githubusercontent.com/rstudio/cheatsheets/main/data-visualization.pdf.
For plotly the website https://plotly.com/r/ offers examples and a cheatsheet can be downdloaded in https://images.plot.ly/plotly-documentation/images/r_cheat_sheet.pdf.
Note that the echo = FALSE parameter can be added to the code chunk to prevent printing of the R code that generate the plots.
ggplot2ggplot(pressure, aes(temperature, pressure)) +
geom_point() +
theme_bw()
Figure 1.1: Plot caption example
plotlyplot_ly(pressure, x = ~temperature, y = ~pressure, type = "scatter", mode = "markers+lines")
Figure 1.2: Plot caption example
The report was produced on 2022-10-18 15:38:44. The data and report are stored in C:/Users/MZmine/Documents/R Projects/streamFind/dev of the workstation DESKTOP-F9E575G under the user MZmine.
Insitut für Energie- und Umwelttechnik e.V. (IUTA)
For further questions, please contact Ricardo Cunha (cunha@iuta.de).